<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div id="container">
    <p>This test crashes if ASSERT is enabled and
        the shadow DOM distribution is not properly updated before flat tree traversals.
</div>
<script>
setup({ explicit_done: true });

function setNeedsDistributionRecalc() {
    var element = document.createElement("div");
    container.appendChild(element);
    var shadowRoot = element.attachShadow({mode: 'open'});
}

test(function () {
    setNeedsDistributionRecalc();
    document.fonts.load("1em ahem")
        .then(function () {
            if (window.testRunner)
                container.style.display = "none";
            done();
        });
}, "document.fonts.load() when needsDistributionRecalc");
</script>
